class Node(object):
	def __init__(self, value): #constructeur d'instance. Et self = this du C++ = instance courante
		self.value = value
		self.parent = None
		self.right = None
		self.left = None

	def printIncreasing(self):
		if self.left != None:
			self.left.printIncreasing()
		print '-' + `self.value` + '-',
		if self.right != None:
			self.right.printIncreasing()

	def printDecreasing(self):
		if self.right != None:
			self.right.printDecreasing()
		print '-' + `self.value` + '-',
		if self.left != None:
			self.left.printDecreasing()

	def printTreeOrder(self):
		print '-' + `self.value` + '-',
		if self.left != None:
			self.left.printTreeOrder()
		if self.right != None:
			self.right.printTreeOrder()


	def insertValue(self, value):
		if value < self.value:
			if self.left == None:
				self.left = Node(value)
				self.left.parent = self
			else:
				self.left.insertValue(value)
		elif value > self.value:#arbre sans doublon sans 
			if self.right == None:
				self.right = Node(value)
				self.right.parent = self
			else:
				self.right.insertValue(value)

class Tree(object):
	def __init__(self):
		self.root = None

	def insertValue(self, value):
		if self.root == None:
			self.root = Node(value)
		else:
			self.root.insertValue(value)

	def printIncreasing(self):
		if self.root != None:
			self.root.printIncreasing()
		print ""

	def printDecreasing(self):
		if self.root != None:
			self.root.printDecreasing()
		print ""

	def printTreeOrder(self):
		if self.root != None:
			self.root.printTreeOrder()
		print ""


if __name__ == '__main__':
	tree = Tree()
	tree.insertValue(8)
	tree.insertValue(3)
	tree.insertValue(1)
	tree.insertValue(6)
	tree.insertValue(4)
	tree.insertValue(7)
	tree.insertValue(10)
	tree.insertValue(14)
	tree.insertValue(13)
	print "Ordre croissant:"
	tree.printIncreasing()
	print "Ordre decroissant:"
	tree.printDecreasing()
	print "Ordre de l'arbre:"
	tree.printTreeOrder()

